-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Router for acre #53
Router for acre #53
Conversation
|
||
/// @notice Acre Manager address. Only Acre Manager can set or remove | ||
/// Strategy Allocators. | ||
/// @notice Acre Manager address. Only Acre Manager can set or remove Vaults. | ||
address public acreManager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of introducing onlyAcreManager
modifier in this contract, maybe we could just use the onlyOwner
modifier from Ownable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a border line biz decision. I assumed we'd have at least one role like Acre Manager and having an owner for different things like contract upgrades. If we move ownership to DAO/Council and need to quickly add/remove a Yield Module then from my experience it can take a while. Acre Manager can act faster. Anyway, I'm fine with both, just need some biz decisions and implement accordingly.
/// @notice Routes funds from stBTC (Acre) to a given vault | ||
/// @param vault Address of the vault to route the funds to. | ||
/// @param amount Amount of TBTC to deposit. | ||
function deposit(address vault, uint256 amount) public { | ||
require(msg.sender == address(stBTC), "stBTC only"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of requiring stBTC
contract to call deposit
/redeem
functions, could we introduce a maintainer/keeper role that will be allowed to call these functions?
The holder of this role will be a bot or a contract with consensus or veto mechanism.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're making an Acre
contract the one that holds TBTC
and TBTC yield
then either way we need to call a function on Acre
so it can approve the TBTC
allowance that AcreRouter
can proxy to a Yield Module. This makes AcreRouter
asset-less, it can do some math and routes assets back and forth, but it doesn't hold actual tokens. So back to maintainer/keeper.. why don't we implement something like this:
Acre {
(...)
// we can call it fund/sendAssets or whatever
routeAssets(...) onlyMaintainerOrManager {
tBTC.approve(address(acreRouter), amount);
AcreRouter.deposit(vault, amount);
}
}
I bet similar case would be for Redeem/Withdraw functions, except AcreRouter will take TBTC assets from YieldModule and route it back to Acre contract. Thoughts?
Added some of the functions for Acre Router backed by OpenZeppelin ERC4626 implementation.
Vault is a more generic name and this wording is present in ERC4626 standard.
582e100
to
bf767b6
Compare
It is required to provide expected min shares or assets. If the req is not satisfied, the tx will be reverted.
Distribution to a Yield Module Vault is driven by distributions percentage set during the Vault addition or update by the Acre Manager. The concrete amount is calculated as the vault's percent allowance of the total TBTC balance in Acre (stBTC) contract.
This PR will be split into smaller PRs: handling vault, adding deposit and redeem functions, adding vaults distribution and handling upgradability. |
WIP